<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        table {
            border-collapse: collapse;
            margin: 100px auto;
        }

        thead {
            background-color: blue;
            color: #fff;
        }

        tr {
            text-align: center;
        }

        td {
            padding: 10px 20px;
            border: 0;
        }

        .bg {
            background-color: pink;
        }
    </style>
</head>

<body>
    <table>
        <thead>
            <tr>
                <td>代码</td>
                <td>名称</td>
                <td>最新公布净值</td>
                <td>累计净值</td>
                <td>前单位净值</td>
                <td>净值增长率</td>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>003526</td>
                <td>3个月定期开放债卷</td>
                <td>003526</td>
                <td>003526</td>
                <td>003526</td>
                <td>003526</td>
            </tr>
            <tr>
                <td>003526</td>
                <td>3个月定期开放债卷</td>
                <td>003526</td>
                <td>003526</td>
                <td>003526</td>
                <td>003526</td>
            </tr>
            <tr>
                <td>003526</td>
                <td>3个月定期开放债卷</td>
                <td>003526</td>
                <td>003526</td>
                <td>003526</td>
                <td>003526</td>
            </tr>
            <tr>
                <td>003526</td>
                <td>3个月定期开放债卷</td>
                <td>003526</td>
                <td>003526</td>
                <td>003526</td>
                <td>003526</td>
            </tr>
            <tr>
                <td>003526</td>
                <td>3个月定期开放债卷</td>
                <td>003526</td>
                <td>003526</td>
                <td>003526</td>
                <td>003526</td>
            </tr>
            <tr>
                <td>003526</td>
                <td>3个月定期开放债卷</td>
                <td>003526</td>
                <td>003526</td>
                <td>003526</td>
                <td>003526</td>
            </tr>
        </tbody>
    </table>
    <script>
        var trs = document.querySelector('tbody').querySelectorAll('tr');
        //利用循环绑定注册事件
        for (let i = 0; i < trs.length; i++) {
            trs[i].onmouseover = function () {
                this.className = 'bg';
            }
            trs[i].onmouseout = function () {
                this.className = '';
            }
        }
    </script>
</body>

</html>